﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AdminUsers.aspx.cs" Inherits="TaskWebApplicationUI.AdminUsers"
         Theme="TaskTheme" ValidateRequest="false" MasterPageFile="WebTasksMaster.Master" %>
<%@ Import Namespace="TaskKernel.Configuration" %>
<%@ Register Assembly="Microsoft.Practices.Web.UI.WebControls" Namespace="Microsoft.Practices.Web.UI.WebControls"
             TagPrefix="pp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MasterPagePlaceHolder" runat="Server">
    <pp:objectcontainerdatasource id="ObjectContainerDataSource1" runat="server" 
                                  ondeleted="ObjectContainerDataSource1_Deleted" oninserted="ObjectContainerDataSource1_Inserted"
                                  onupdated="ObjectContainerDataSource1_Updated" />
    <p align="center">
        <asp:Label ID="Department" SkinID="Department" runat="server" Text="Список пользователей"></asp:Label>
    </p>
    <asp:DetailsView ID="DetailsView2" runat="server" AutoGenerateRows="False" DataSourceID="ObjectContainerDataSource1"
                     DefaultMode="Insert">
        <Fields>
            <asp:TemplateField HeaderText="Имя учетной записи">
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox2" CssClass="bodyt" runat="server" Text='<%#Bind("Login")%>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="ФИО">
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox3" CssClass="bodyt" runat="server" Text='<%#Bind("FullName")%>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="E-mail">
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox4" CssClass="bodyt" runat="server" Text='<%#Bind("Mail")%>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Уволен">
                <InsertItemTemplate>
                    <asp:CheckBox ID="Fired" CssClass="bodyt" runat="server" Checked='<%#Bind("Fired")%>'></asp:CheckBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Название отдела">
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox1" CssClass="bodyt" runat="server" Text='<%#Bind("DepartmentName")%>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Должность">
                <InsertItemTemplate>
                    <asp:TextBox ID="JobTitleTB" CssClass="bodyt" runat="server" Text='<%#Bind("JobTitle")%>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Телефон">
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox5" CssClass="bodyt" runat="server" Text='<%#Bind("Phone")%>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="SID">
                <InsertItemTemplate>
                    <asp:TextBox ID="SID" CssClass="bodyt" runat="server" Text='<%#Bind("SID")%>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:CommandField ShowCancelButton="false" ShowInsertButton="True" InsertText="Внести" />
        </Fields>
    </asp:DetailsView>
    <hr />
    <asp:UpdatePanel ID="UpdatePanel4" runat="server">
        <ContentTemplate>
            <asp:Label ID="Label1" runat="server" ForeColor="Red" CssClass="bodyt"></asp:Label>
            <br />

            <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectContainerDataSource1"
                          BorderWidth="1px" CssClass="grid-view" GridLines="None" CellPadding="4" BorderStyle="None"
                          AllowSorting="True" DataKeyNames="UID" EnableModelValidation="True">
                <Columns>
                    <asp:TemplateField HeaderText="UID" SortExpression="UID">
                        <ItemTemplate>
                            <asp:Label ID="UID" runat="server" Text='<%#Bind("UID")%>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Имя уч. записи" SortExpression="Login">
                        <ItemTemplate>
                            <asp:Label ID="Login" runat="server" Text='<%#Bind("Login")%>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="Login" runat="server" Text='<%#Bind("Login")%>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="ФИО" SortExpression="FullName">
                        <ItemTemplate>
                            <a href='<%=TaskKernelConfiguration.ManagersPage%><%#Eval("UID")%>'>
                                <%#Eval("FullName")%></a>
                            <%--<asp:Label ID="FullName" runat="server" Text='<%# Bind("FullName") %>'></asp:Label>--%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="FullName" runat="server" Text='<%#Bind("FullName")%>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="E-mail">
                        <ItemTemplate>
                            <asp:Label ID="Mail" runat="server" Text='<%#Bind("Mail")%>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="Mail" runat="server" Text='<%#Bind("Mail")%>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Уволен" SortExpression="Fired">
                        <ItemTemplate>
                            <asp:CheckBox ID="Fired" Enabled="false" runat="server" Checked='<%#Bind("Fired")%>'>
                            </asp:CheckBox>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox ID="Fired" runat="server" Checked='<%#Bind("Fired")%>'></asp:CheckBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Название отдела">
                        <ItemTemplate>
                            <asp:Label ID="DepartmentName" runat="server" Text='<%#Bind("DepartmentName")%>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="DepartmentName" runat="server" Text='<%#Bind("DepartmentName")%>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Должность">
                        <ItemTemplate>
                            <asp:Label ID="JobTitle" runat="server" Text='<%#Bind("JobTitle")%>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="JobTitle" runat="server" Text='<%#Bind("JobTitle")%>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Телефон">
                        <ItemTemplate>
                            <asp:Label ID="Phone" runat="server" Text='<%#Bind("Phone")%>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="Phone" runat="server" Text='<%#Bind("Phone")%>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField ShowHeader="False">
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                                            Text="Изменить"></asp:LinkButton>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                                            Text="ОК"></asp:LinkButton>
                            &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                                                  Text="Отмена"></asp:LinkButton>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="Button2" runat="server" CausesValidation="False" CommandName="Delete"
                                            Text="Удалить" OnClientClick="return confirm('Удалить ?');" />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <EditRowStyle HorizontalAlign="Right" />
                <RowStyle HorizontalAlign="Right" />
            </asp:GridView>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>